#! /bin/sh
#
# Initially written by John Wu <John.Wu at acm.org> on Jun 1 2009
# Copyright 2009 the Regents of the University of California
#
# This file is part of FastBit project distributed under the terms of
# LGPL.  By continuing to use, modify, or distribute this file you
# indicate that you have read the license and understand and accept it
# fully.

prefix=@prefix@
includedir=@includedir@
libdir=@prefix@@libdir@

usage()
{
  cat <<EOF
Usage: fastbit-config [OPTION]...
Get @PACKAGE_STRING@ compilation and linking information.

Options:
  --prefix               display \`--prefix' value used for building the
                         FastBit library
  --version              display FastBit version number
  --libs                 display flags for linking with the FastBit library
  --cflags               display flags for compiling with the FastBit
                         library
EOF
  exit $1
}

if test $# -eq 0 ; then
  usage 1 1>&2
fi

while test $# -gt 0 ; do
  case $1 in
  --prefix)
    echo_prefix=yes
    ;;
  --version)
    echo_fb_version=yes
    ;;
  --cflags)
    echo_cflags=yes
    ;;
  --libs)
    echo_libs=yes
    ;;
  *)
    usage 1 1>&2
    ;;
  esac
  shift
done

if test "$echo_prefix" = "yes" ; then
  echo $prefix
fi

if test "$echo_exec_prefix" = "yes" ; then
  echo $exec_prefix
fi

if test "$echo_fb_version" = "yes" ; then
  echo "@PACKAGE_STRING@"
fi

if test "$echo_cflags" = "yes" ; then
  cflags="@DEFS@ @AM_CPPFLAGS@ @PTHREAD_CFLAGS@"
  if test "$includedir" != "/usr/include" ; then
    echo $cflags -I$includedir
  else
    echo $cflags
  fi
fi

if test "$echo_libs" = "yes" ; then
  libs="-lfastbit @LIBS@ @PTHREAD_LIBS@"
  if test "$libdir" != "/usr/lib" && test "$libdir" != "/usr/lib64"; then
    echo -L$libdir $libs
  else
    echo $libs
  fi
fi
 
# EOF
